package org.fastsyncer.manager.listener.mysql.binlog.impl.event;

import java.util.List;

import org.fastsyncer.manager.listener.mysql.binlog.BinlogEventV4Header;
import org.fastsyncer.manager.listener.mysql.common.glossary.Row;
import org.fastsyncer.manager.listener.mysql.common.glossary.UnsignedLong;
import org.fastsyncer.manager.listener.mysql.common.glossary.column.BitColumn;
import org.fastsyncer.manager.listener.mysql.common.util.MySQLConstants;
import org.fastsyncer.manager.listener.mysql.common.util.ToStringBuilder;

/**
 * Used for row-based binary logging. This event logs deletions of rows in a single table.
 * @ClassName: DeleteRowsEvent 
 * @author: AE86
 * @date: 2018年10月17日 下午2:24:57
 */
public final class DeleteRowsEventV2 extends AbstractRowEvent {
	public static final int EVENT_TYPE = MySQLConstants.DELETE_ROWS_EVENT_V2;

	private int extraInfoLength;
	private byte extraInfo[];
	private UnsignedLong columnCount;
	private BitColumn usedColumns;
	private List<Row> rows;

	public DeleteRowsEventV2() {
	}

	public DeleteRowsEventV2(BinlogEventV4Header header) {
		this.header = header;
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this)
		.append("header", header)
		.append("tableId", tableId)
		.append("reserved", reserved)
		.append("extraInfoLength", extraInfoLength)
		.append("extraInfo", extraInfo)
		.append("columnCount", columnCount)
		.append("usedColumns", usedColumns)
		.append("rows", rows).toString();
	}

	public int getExtraInfoLength() {
		return extraInfoLength;
	}

	public void setExtraInfoLength(int extraInfoLength) {
		this.extraInfoLength = extraInfoLength;
	}

	public byte[] getExtraInfo() {
		return extraInfo;
	}

	public void setExtraInfo(byte[] extraInfo) {
		this.extraInfo = extraInfo;
	}

	public UnsignedLong getColumnCount() {
		return columnCount;
	}

	public void setColumnCount(UnsignedLong columnCount) {
		this.columnCount = columnCount;
	}

	public BitColumn getUsedColumns() {
		return usedColumns;
	}

	public void setUsedColumns(BitColumn usedColumns) {
		this.usedColumns = usedColumns;
	}

	public List<Row> getRows() {
		return rows;
	}

	public void setRows(List<Row> rows) {
		this.rows = rows;
	}
}
